package com.examination.to.controller;

import com.examination.to.entity.QuestionBank;
import com.examination.to.service.impl.QuestionBankServiceImpl;
import com.examination.to.service.impl.QuestionToBankServiceImpl;
import com.examination.to.util.Result;

import com.examination.to.vo.QuestionVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/questionBank")
public class QuestionBankController {

    @Autowired
    private QuestionBankServiceImpl questionBankService;

    @Autowired
    private QuestionToBankServiceImpl questionToBankService;

    @RequestMapping("/addQuestionBank")
    public Result addQuestionBank(@RequestBody QuestionBank questionBank){
        return questionBankService.addQuestionBank(questionBank);
    }

    @PostMapping("/deletetQuestionBank")
    public Result deleteQuestionBank(@RequestParam Integer bankid){
        return questionBankService.deleteQuestionBank(bankid);
    }

    @PostMapping("/updateQuestionBank")
    public Result updateQuestionBank(@RequestBody QuestionBank questionBank){
        return questionBankService.updateQuestionBank(questionBank);
    }

    @PostMapping("/addToQuestionBank")
    public Result addToQuestionBank(@RequestBody QuestionVo questionVo){
        return questionToBankService.addToQuestionBank(questionVo);
    }

    @PostMapping("/deleteQuestionInBank")
    public Result deleteQuestionInBank(@RequestParam Integer id){
        return questionToBankService.deleteQuestionInBank(id);
    }



}
